package com.sogeti.mentormatch.command
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.sogeti.mentormatch.model.MentorModelLocator;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	/**
	 * The LogoutCommand class will handle logging out of our application and ending the backend session
	 */
	public class LogoutCommand implements ICommand, IResponder
	{
		private var mentorModel:MentorModelLocator = MentorModelLocator.getInstance();
		public function execute(event:CairngormEvent):void
		{
			//Go straight to result method
			result(event);
		}
		
		public function result(data:Object):void
		{
			mentorModel.masterNavigationStateString = MentorModelLocator.MASTER_VIEW_NOT_LOGGED_IN;
		}
		
		public function fault(info:Object):void
		{
			Alert.show("There was a problem trying to logout. Please close your browser and hit yourself in the head with a tack hammer.");
		}
		
	}
}